﻿namespace ComputedTable.Version10
{
    public class CellOperationResult
    {
        public object Value { get; private set; }
        public string Message { get; private set; }
        public bool Succeed { get { return this.Message == null; } }

        public static CellOperationResult SucceedCellOperationResult = new CellOperationResult();

        private CellOperationResult()
        {
        }

        public static CellOperationResult CreateSucceed(object value)
        {
            return new CellOperationResult { Value = value };
        }

        public static CellOperationResult CreatedFailed(string format, params object[] args)
        {
            return CreatedFailed(string.Format(format, args));
        }

        public static CellOperationResult CreatedFailed(string message)
        {
            return new CellOperationResult { Message = message };
        }
    }
}
